package Operation;

import Book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:岁亮亮
 * Date:2024-01-14
 * TIME:15:39
 */
public class check implements Iooperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("查找图书");
        System.out.println("请输入你要查找图书的书名");
        Scanner scanner=new Scanner(System.in);
        String str=scanner.nextLine();
        int ret=bookList.getUsesize();
        int flag=-1;
        for (int i = 0; i < ret; i++) {
            if(str.equals(bookList.getbooks(i) .getName())){
                flag=i;
            }
        }
        if(flag==-1){
            System.out.println("书架上没有你要查找的书");
        }
        else {
            System.out.println("查找结果如下");
            System.out.println(bookList .getbooks(flag) );
        }
    }
}
